package pro.meisen.blog.dao.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import pro.meisen.blog.dao.domain.Article;
import pro.meisen.blog.dao.mapper.ArticleMapper;

import java.util.List;

@RestController
public class ArticleController {
    @Autowired
    private ArticleMapper articleMapper;

    @GetMapping("/size")
    public Integer size() {
        List<Article> articleList = articleMapper.selectAll();
        return CollectionUtils.isEmpty(articleList) ? 0 : articleList.size();
    }
}
